/**
 * @file key.h
 * @brief this is a brief description
 * @details this is the detail description.
 * @author fulong 
 * @data 7/1/2014
 * @version 1.0
 * @par Copyright (c):
 * @par First build
 *     version: fulong 
 *     data: 7/1/2014
 */
#ifndef __KEY_H__
#define __KEY_H__
#include "../hal_include/hal_types.h"


typedef enum
{
    KEY_LEFT,
    KEY_RIGHT,
    KEY_UP,
    KEY_DOWN,
    KEY_ONCE_PRINT,
    KEY_AUTO_CONTINUE,
    KEY_HOME,
    KEY_SETTING
}key_code;

typedef union {
    struct {
        uint8 pin0:1;
        uint8 pin1:1;
        uint8 pin2:1;
        uint8 pin3:1;
        uint8 pin4:1;
        uint8 pin5:1;
        uint8 pin6:1;
        uint8 pin7:1;
        uint8 pin10:1;
        uint8 pin11:1;
        uint8 pin12:1;
        uint8 pin13:1;
        uint8 pin14:1;
        uint8 pin15:1;
        uint8 pin16:1;
        uint8 pin17:1;
        uint8 pin20:1;
        uint8 pin21:1;
        uint8 pin22:1;
        uint8 pin23:1;
        uint8 pin24:1;
        uint8 pin25:1;
        uint8 pin26:1;
        uint8 pin27:1;
        uint8 pin28:1;
        uint8 pin29:1;
        uint8 pin30:1;
        uint8 pin31:1;
    }bit;
    uint32 key;
} key_addr;

typedef enum
{
    KEY_INIT,
    KEY_GITTER,
    KEY_PRESS,
    KEY_CONTINUE_PRESS,
}key_status;

typedef enum {
    KEY_FUN_HOME,
    KEY_FUN_SAVE,
    KEY_FUN_STOP
}key_home_function_code;

typedef enum {
    KEY_RECEIVED = 0,
    KEY_PROCESSED = 1,
    KEY_PROCESSING = 2
}key_process_status;
typedef struct {
    uint8 used;
    uint8 status;
    key_addr union_key;
}cur_key_status;
extern void key_io_init(void);
extern void key_status_mechine(void);
extern void key_process(void);

#endif /* __KEY_H__ */


